//
//  THBaseViewController.h
//  MengLiao
//
//  Created by xiuxin on 2022/7/15.
//  Copyright © 2022 BaseBusiness. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "THViewModel.h"
#import "THEmptyView.h"
NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger,THEmptyViewShowType)
{
    THEmptyViewShowTypeNoData = 1,     //无数据
    THEmptyViewShowTypeNoNetwork,      //无网络
    THEmptyViewShowTypeLoading,         //加载中
    THEmptyViewShowTypeIndicatorLoading, //菊花类型加载中
    
};

@interface THBaseViewController : UIViewController


@property (nonatomic,assign) BOOL removeFromStack;

/// viewModel 实例对象
@property (nonatomic,retain,readonly) THViewModel *viewModel;

/// 构建统一的“无数据”、“无网络”、“正在加载中”占位图
@property (nonatomic,retain,readonly) THEmptyView *emptyView;

/// 以viewModel的方式构建ViewController
/// @param viewModel YUViewModel的子类对象
- (instancetype)initWithViewModel:(THViewModel*)viewModel;
/// 配置导航栏
- (void)addNavbarView;
/// 添加子控件
- (void)setupUI;
/// 配置子进行各种绑定
- (void)configViews;
/// 布局子控件
- (void)setupFrames;
/// 数据加载
- (void)afterLoad;

/// 展示占位图emptyView
- (void)showEmptyView;

/// 常规无数据视图根据类型匹配
/// @param type THEmptyViewShowType
- (void)showEmptyViewWithType:(THEmptyViewShowType)type;

///无网络重载按钮事件 (需要子类重写)
- (void)noNetworkToReload;
//移除emptyView
- (void)hideEmptyView;
//@return YES表示成功进行一次布局，NO表示本次调用并没有进行布局操作（例如emptyView还没被初始化）
- (BOOL)layoutEmptyView;


/// 页面唯一标识
- (NSString *)singleFlag;

@end

NS_ASSUME_NONNULL_END
